package com.person.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;


@Data
@AllArgsConstructor
@NoArgsConstructor
public class CommonResult<T> {
    private Integer code;
    private String message;
    private T data;

    public CommonResult(Integer code, String message) {
        this(code, message, null);
    }

    public static CommonResult<Object> ok(Integer code, String message, Object data) {
        return new CommonResult<Object>(code, message, data);
    }

    public static CommonResult<Object> error(String message, Object data) {
        return new CommonResult<Object>(400, message, data);
    }
}
